#include <iostream>
using namespace std;

class MyClass {
  private:
    static int n;

  public:
    MyClass() { n += 1; }
    ~MyClass() { n -= 1; }
    static int GetNum() { return n; }
};

int MyClass::n = 0;

int main() {
    cout << MyClass::GetNum() << endl;
    MyClass obj;
    cout << MyClass::GetNum() << endl;
    MyClass *p = new MyClass;
    cout << MyClass::GetNum() << endl;
    delete p;
    cout << MyClass::GetNum() << endl;
    cout << "end" << endl;

    return 0;
}
